<script setup lang="ts">
import { ref } from "vue";
import { KnoDocGroup } from "@/views/domain/knowledge/api/knoDocGroup";
const emit = defineEmits(["submit"]);

const show = ref(false);
const model = ref<KnoDocGroup>({
  title: "",
  desc: ""
});

const handleClose = () => {
  show.value = false;
};

const handleSubmit = () => {
  handleClose();
  emit("submit", model.value);
};

defineExpose({
  open: () => {
    model.value = {};
    show.value = true;
  }
});
</script>

<template>
  <el-dialog v-model="show" title="新建命名空间" :before-close="handleClose">
    <el-form :model="model" label-width="100px">
      <el-form-item label="命名空间名称" prop="title">
        <el-input v-model="model.title" placeholder="请输入命名空间名称" />
      </el-form-item>
      <el-form-item label="命名空间描述" prop="desc">
        <el-input v-model="model.desc" placeholder="请输入命名空间描述" />
      </el-form-item>
    </el-form>

    <template #footer>
      <el-space>
        <el-button @click="handleClose">取消</el-button>
        <el-button type="primary" @click="handleSubmit">确定</el-button>
      </el-space>
    </template>
  </el-dialog>
</template>
<style lang="scss" scoped></style>
